package com.atguigu.java.langchain4j.Tools;

import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import dev.langchain4j.agent.tool.ToolMemoryId;
import org.springframework.stereotype.Component;

/**
 * @author 沈复龙
 * @date 2025/6/6
 * @description
 */
@Component
public class CalculatorTools {

    @Tool(name ="加法运算" ,value="将两个数相加")
    double sum(@P(value="加数1",required = false) double a, @P(value="加数2",required = false) double b) {
        System.out.println("调用加法运算");
        return a + b;
    }
    @Tool(name ="开平方根",value ="开平方根")
    double squareRoot(@ToolMemoryId int memoryId, double x){
        System.out.println("调用平方根运算memoryId:"+memoryId);
        return  Math.sqrt(x);
    }
}
